import Mock from 'mockjs'
import { CONSTANT_OBJ } from '@/utils/constant'
let baseURL
let locationHref = `http://${window.location.hostname}`
if (CONSTANT_OBJ.ENV !== 'prodMaster') {
  baseURL = CONSTANT_OBJ.URL + CONSTANT_OBJ.PREFIX + '/user'
  // baseURL = URL
} else {
  baseURL = locationHref + CONSTANT_OBJ.PREFIX + '/user'
}
// 用户列表查询
Mock.mock(`${baseURL}/v1/api/user/dict/queryByCondition`, function () {
  return {
    ...CONSTANT_OBJ.MOCK_RESPONSE,
    data: {
      total: 4,
      list: [
        { id: '1', dictName: '产品编号', dictNo: 'product_ID', dicDesc: '描述内容描述内容描述内容描述内容描述内容描述内容', updateTime: '2022-08-05-12:23:12', updateBy: '张三' },
        { id: '2', dictName: '现单位工龄', dictNo: 'workingYears', dicDesc: '描述内容描述内容描述内容描述内容描述内容描述内容', updateTime: '2022-08-05-12:23:12', updateBy: '张三' },
        { id: '3', dictName: '教育程度', dictNo: 'education', dicDesc: '描述内容描述内容描述内容描述内容描述内容描述内容', updateTime: '2022-08-05-12:23:12', updateBy: '张三' },
        { id: '4', dictName: '房产情况', dictNo: 'houseStatus', dicDesc: '描述内容描述内容描述内容描述内容描述内容描述内容', updateTime: '2022-08-05-12:23:12', updateBy: '张三' }
      ]
    }
  }
})
// 查看单条详情
Mock.mock(`${baseURL}/v1/api/user/dict/queryById/1`, function () {
  return {
    ...CONSTANT_OBJ.MOCK_RESPONSE,
    data: {
      id: '1',
      dictName: '产品编号',
      dictNo: 'product_ID',
      dicDesc: '描述内容描述内容描述内容描述内容描述内容描述内容',
      childDictList: [
        {
          id: 11,
          dictName: '尊享金',
          dictNo: '1001'
        },
        {
          id: 12,
          dictName: '个贷',
          dictNo: '1002'
        }, {
          id: 13,
          dictName: '凡享金',
          dictNo: '1003'
        },
        {
          id: 14,
          dictName: '尊享金',
          dictNo: '1001'
        },
        {
          id: 15,
          dictName: '个贷',
          dictNo: '1002'
        }, {
          id: 16,
          dictName: '凡享金',
          dictNo: '1003'
        },
        {
          id: 17,
          dictName: '尊享金',
          dictNo: '1001'
        },
        {
          id: 18,
          dictName: '个贷',
          dictNo: '1002'
        },
        {
          id: 19,
          dictName: '凡享金',
          dictNo: '1003'
        },
        {
          id: 101,
          dictName: '个贷3',
          dictNo: '1002'
        },
        {
          id: 102,
          dictName: '凡享金3',
          dictNo: '1003'
        }
      ]
    }
  }
})

// 新增子字典
Mock.mock(`${baseURL}/v1/api/user/dictCild/add`, function () {
  return {
    ...CONSTANT_OBJ.MOCK_RESPONSE
  }
})
// 编辑子字典
Mock.mock(`${baseURL}/v1/api/user/dictCild/edit`, function () {
  return {
    ...CONSTANT_OBJ.MOCK_RESPONSE
  }
})
// 编辑字典
Mock.mock(`${baseURL}/v1/api/user/dict/edit`, function () {
  return {
    ...CONSTANT_OBJ.MOCK_RESPONSE
  }
})
